package com.rain.lo.controller;

import com.rain.lo.common.Constants;
import com.rain.lo.service.UserService;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class TestController {

    @Resource
    private UserService userService;

    @RequestMapping("test.html")
    public String showSignup(){
        return "test";
    }

    @ResponseBody
    @RequestMapping("user")
    public Object showUser(){
        return userService.queryUserByName("张三");
    }

    public static void main(String[] args) {
        String password = DigestUtils.md5Hex("123456");
        System.out.println(DigestUtils.md5Hex(password+ Constants.PASSWORD_SOLT));
    }
}
